home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / mac / files / t_sys5 / unixcpio.gz / unixnet.cpio / udpcmd.c < prev    next >
C/C++ Source or Header  |  1994-07-11  |  920b  |  42 lines

  1. /* UDP-related user commands */
  2. #include <stdio.h>
  3. #include "global.h"
  4. #include "mbuf.h"
  5. #include "netuser.h"
  6. #include "udp.h"
  7. #include "internet.h"
  8. #include "cmdparse.h"
  9.  
  10. int doudpstat();
  11. struct cmds udpcmds[] = {
  12.     "status",    doudpstat,    0,    NULLCHAR,    NULLCHAR,
  13.     NULLCHAR,    NULLFP,        0,
  14.         "udp subcommands: status",    NULLCHAR,
  15. };
  16.  
  17. doudp(argc,argv)
  18. int argc;
  19. char *argv[];
  20. {
  21.     return subcmd(udpcmds,argc,argv);
  22. }
  23. /* Dump UDP statistics and control blocks */
  24. doudpstat()
  25. {
  26.     extern struct udp_stat udp_stat;
  27.     char *psocket();
  28.     register struct udp_cb *udp;
  29.     register int i;
  30.  
  31.     printf("sent %u rcvd %u bdcsts %u cksum err %u unknown socket %u\n",
  32.     udp_stat.sent,udp_stat.rcvd,udp_stat.bdcsts,udp_stat.cksum,udp_stat.unknown);
  33.     printf("    &UCB Rcv-Q  Local socket\n");
  34.     for(i=0;i<NUDP;i++){
  35.         for(udp = udps[i];udp != NULLUDP; udp = udp->next){
  36.             printf("%8lx%6u  %s\n",(long)udp,udp->rcvcnt,
  37.              psocket(&udp->socket));
  38.         }
  39.     }
  40. }
  41.  
  42.